Docker by Karl Matthias
Author:Karl Matthias
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2015-06-24T16:00:00+00:00
$ docker stats e64a279663aa CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O e64a279663aa 0.00% 7.227 MiB/987.9 MiB 0.73% 936 B/468 B
Here we can see the container ID (but not the name), the amount of CPU it’s currently consuming, the amout of memory it has in use, and the limit of what it’s allowed to use. The percentage of memory utilized is also provided to make it easier for the user to quickly determine how much free memory the container has available. And stats are provided for both in and out network bytes.
These are all of basic interest, but what they provide is not all that exciting. It turns out, though, that the Docker API provides a lot more information on the stats endpoint than is shown in the client. We’ve steered away from hitting the API in this book so far, but in this case the data provided by the API is so much richer that we’ll use curl to call it and see what our container is doing. It’s nowhere near as nice to read, but there is a lot more detail. This is a good intro to calling the API yourself as well.
The /stats/ endpoint that we’ll hit on the API will continue to stream stats to us as long as we keep the connection open. Since as humans we can’t really parse usefully, we’ll just ask for one line and then use Python to “pretty print” it. In order for this command to work, you’ll need to have Python installed (version 2.6 or later). If you don’t and you still want to see the JSON output, you can skip the pipe to Python, but you’ll get plain, ugly JSON back.
Here we call localhost, but you’ll want to use the hostname of your Docker server. Port 2375 is usually the right port. Note that we also pass the ID of our container in the URL we send to curl.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
COM, DCOM & ATL | Device Drivers |
EPOC-Symbian | Microsoft Windows Registry |
Novell Netware | Operating Systems Theory |
Unicode | Unix |
Win32 API |
Deep Learning with Python by François Chollet(11941)
Hello! Python by Anthony Briggs(9399)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9364)
The Mikado Method by Ola Ellnestam Daniel Brolund(9330)
Dependency Injection in .NET by Mark Seemann(8880)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7873)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7367)
Grails in Action by Glen Smith Peter Ledbrook(7313)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7140)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5978)
Kotlin in Action by Dmitry Jemerov(4662)
Practical Vim (for Kathryn Amaral) by Drew Neil(3734)
Cracking the GRE Premium Edition with 6 Practice Tests, 2015 (Graduate School Test Preparation) by Princeton Review(3608)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3472)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3261)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(2934)
Learning Java by Patrick Niemeyer & Daniel Leuck(2877)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2849)
Microservices with Go by Alexander Shuiskov(2727)